<?php
$current_path = dirname(__FILE__);
$files_path = dirname(__FILE__).'/files/';

include('./class_archive.php5');
$gzip = new gzip_file('tmpfile');

$gzip->set_options(array('basedir' => dirname(__FILE__), 'level' => 9));

$gzip->add_files('*', $files_path, '');

$gzip->create_archive();

$setup = file_get_contents(dirname(__FILE__).'/../../tt_install/index.php5');

$setup = preg_replace("/base64_decode\('[^']*'\)/", "base64_decode('".chunk_split(base64_encode(file_get_contents($current_path.'/tmpfile')))."')", $setup);

file_put_contents(dirname(__FILE__).'/../../tt_install/index.php5', $setup);
unlink($current_path.'/tmpfile');
echo 'ok '.time();
?>